package com.uchengwang.ui.cm_ui.me.ui;

import android.os.Bundle;
import android.support.v7.widget.SwitchCompat;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;

import com.uchengwang.R;
import com.uchengwang.ui.base_ui.ui.BaseWithTitleActivity;
import com.uchengwang.ui.utils.SPUtils;


/**
 * Created by U城网 on 2017/6/12.
 * 消息设置
 */

public class MsgSettingActivity extends BaseWithTitleActivity {

    private RelativeLayout newMsg_rl, authenUser_rl, fans_rl, atten_rl, ucw_rl, sound_rl, shake_rl;
    private SwitchCompat newMsg_bt, authenUser_bt, fans_bt, atten_bt, ucw_bt, sound_bt, shake_bt;

    private boolean isMsgAllow;//true不允许 false允许[默认]
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_msg_set);
        setTitle("消息设置");

        initView();
    }

    private void initView(){
        newMsg_rl = (RelativeLayout) findViewById(R.id.msgSet_newMsg_rl);
        newMsg_bt = (SwitchCompat) findViewById(R.id.msgSet_newMsg_bt);

        newMsg_bt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                SPUtils.getPreferences(MsgSettingActivity.this).setMsgNotNotifyAllowed(!b);
            }
        });

        initData();
    }

    private void initData(){
        isMsgAllow = SPUtils.getPreferences(this).getMsgNotNotifyAllowed();
        newMsg_bt.setChecked(!isMsgAllow);

    }


}
